package com.lyp.crm.util;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration 
public class Swagger2Config { 
      @Bean 
      public Docket createRestApi() { 
 // 扫描控制器中 Swagger2 的注解 , .apis 里面的参数表示 指定包
 
 return new Docket(DocumentationType.SWAGGER_2) 
   .apiInfo(apiInfo()) 
   .select()
         .apis(RequestHandlerSelectors.basePackage("com.lyp.crm.conrtoller"))  
 .paths(PathSelectors.any()) 
   .build(); 
      } 
//API 描述信息
 
private ApiInfo apiInfo() { 
 return new ApiInfoBuilder()   
		 .title("springboot 利用 swagger 构建 api 文档")  
		 .description("李亚朋组") 
		 .termsOfServiceUrl("http://blog.csdn.net/saytime") 
		 .version("1.0") 
		 .build(); 
     } 
} 